package com.ruoyi.checkingin.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;

import com.ruoyi.checkingin.service.IEChecksService;
import com.ruoyi.common.core.domain.e_checkingin.EChecks;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.core.domain.e_checkingin.ERpStandard;
import com.ruoyi.checkingin.service.IERpStandardService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 奖惩信息Controller
 * 
 * @author JYW
 * @date 2024-01-30
 */
@RestController
@RequestMapping("/checkingin/standard")
public class ERpStandardController extends BaseController
{
    @Autowired
    private IERpStandardService eRpStandardService;

    /**
     * 查询奖惩信息列表
     */
    @PreAuthorize("@ss.hasPermi('checkingin:standard:list')")
    @GetMapping("/list")
    public TableDataInfo list(ERpStandard eRpStandard)
    {
        startPage();
        List<ERpStandard> list = eRpStandardService.selectERpStandardList(eRpStandard);
        return getDataTable(list);
    }

    /**
     * 导出奖惩信息列表
     */
    @PreAuthorize("@ss.hasPermi('checkingin:standard:export')")
    @Log(title = "奖惩信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, ERpStandard eRpStandard)
    {
        List<ERpStandard> list = eRpStandardService.selectERpStandardList(eRpStandard);
        ExcelUtil<ERpStandard> util = new ExcelUtil<ERpStandard>(ERpStandard.class);
        util.exportExcel(response, list, "奖惩信息数据");
    }

    /**
     * 获取奖惩信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('checkingin:standard:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(eRpStandardService.selectERpStandardById(id));
    }

    /**
     * 新增奖惩信息
     */
    @PreAuthorize("@ss.hasPermi('checkingin:standard:add')")
    @Log(title = "奖惩信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody ERpStandard eRpStandard)
    {
            return toAjax(eRpStandardService.insertERpStandard(eRpStandard));
    }

    /**
     * 修改奖惩信息
     */
    @PreAuthorize("@ss.hasPermi('checkingin:standard:edit')")
    @Log(title = "奖惩信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody ERpStandard eRpStandard)
    {
        return toAjax(eRpStandardService.updateERpStandard(eRpStandard));
    }

    /**
     * 删除奖惩信息
     */
    @PreAuthorize("@ss.hasPermi('checkingin:standard:remove')")
    @Log(title = "奖惩信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(eRpStandardService.deleteERpStandardByIds(ids));
    }

}
